As with many other places, hike at your own risk. Cacti, prickly pears, bees, and steep slopes and edges are the primary things to be cautious of on some trails, but otherwise, hiking on Capri's trails is generally quite safe. However, be careful when walking down paths around the villas when alone, as many of the residents of the villas keep large dogs which may roam freely onto the public pathways; these dogs are not particularly friendly to foreigners of the island.
Swimming in the Grottos is only for the very experienced, as tides can easily open and close the Grottos and smash swimmers against the rocks when trying to enter or exit. Swimming alone in the Grottoes is highly discouraged.